package com.taysear.parcel.domain;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@SuppressWarnings("serial")
@Entity
public class Parcel implements Serializable{

	@Id @Column(name="parcelId") @GeneratedValue(strategy = GenerationType.IDENTITY)
	private Integer parcelId;
	@Temporal(TemporalType.TIMESTAMP) 
	private Date date;
	private String waybillNumber;
	private Double amount;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="paymentMode")
	private PaymentMode paymentMode;
	private Boolean vatable ;
	private Double vatAmount ;
	private Integer quantity ;
	private Double weight ;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="parcelType")
	private ParcelType parcelType ;
	private Double cbm ;
	private String description ;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="loadingsheet")
	private Loadingsheet loadingsheet;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="parcelStatus")
	private ParcelStatus parcelStatus ;
	@OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="parcelDetail")
	private ParcelDetail parcelDetail;
	@ManyToOne(fetch=FetchType.LAZY) @JoinColumn(name="user")
	private User user;
	private String verificationCode;
	private int verificationAttempts = 0;
	private Boolean verificationLock = false;
	@OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="account")
	private Account account;
	@OneToOne(fetch=FetchType.LAZY) @JoinColumn(name="currency")
	private Currency currency;
	
	@OneToMany(mappedBy="parcel", fetch=FetchType.LAZY) @JoinColumn(name="parcelId")
	private List<ParcelHistory> parcelHistories;

	public Integer getParcelId() {
		return parcelId;
	}
	public void setParcelId(Integer parcelId) {
		this.parcelId = parcelId;
	}
	public Date getDate() {
		return date;
	}
	public void setDate(Date date) {
		this.date = date;
	}
	public String getWaybillNumber() {
		return waybillNumber;
	}
	public void setWaybillNumber(String waybillNumber) {
		this.waybillNumber = waybillNumber;
	}
	public Double getAmount() {
		return amount;
	}
	public void setAmount(Double amount) {
		this.amount = amount;
	}
	public PaymentMode getPaymentMode() {
		return paymentMode;
	}
	public void setPaymentMode(PaymentMode paymentMode) {
		this.paymentMode = paymentMode;
	}
	public Boolean getVatable() {
		return vatable;
	}
	public void setVatable(Boolean vatable) {
		this.vatable = vatable;
	}
	public Double getVatAmount() {
		return vatAmount;
	}
	public void setVatAmount(Double vatAmount) {
		this.vatAmount = vatAmount;
	}
	public Integer getQuantity() {
		return quantity;
	}
	public void setQuantity(Integer quantity) {
		this.quantity = quantity;
	}
	public Double getWeight() {
		return weight;
	}
	public void setWeight(Double weight) {
		this.weight = weight;
	}
	public ParcelType getParcelType() {
		return parcelType;
	}
	public void setParcelType(ParcelType parcelType) {
		this.parcelType = parcelType;
	}
	public Double getCbm() {
		return cbm;
	}
	public void setCbm(Double cbm) {
		this.cbm = cbm;
	}
	public String getDescription() {
		return description;
	}
	public void setDescription(String description) {
		this.description = description;
	}
	public Loadingsheet getLoadingsheet() {
		return loadingsheet;
	}
	public void setLoadingsheet(Loadingsheet loadingsheet) {
		this.loadingsheet = loadingsheet;
	}
	public ParcelStatus getParcelStatus() {
		return parcelStatus;
	}
	public void setParcelStatus(ParcelStatus parcelStatus) {
		this.parcelStatus = parcelStatus;
	}
	public List<ParcelHistory> getParcelHistories() {
		return parcelHistories;
	}
	public void setParcelHistories(List<ParcelHistory> parcelHistories) {
		this.parcelHistories = parcelHistories;
	}
	public ParcelDetail getParcelDetail() {
		return parcelDetail;
	}
	public void setParcelDetail(ParcelDetail parcelDetail) {
		this.parcelDetail = parcelDetail;
	}
	public User getUser() {
		return user;
	}
	public void setUser(User user) {
		this.user = user;
	}
	public String getVerificationCode() {
		return verificationCode;
	}
	public void setVerificationCode(String verificationCode) {
		this.verificationCode = verificationCode;
	}
	public int getVerificationAttempts() {
		return verificationAttempts;
	}
	public void setVerificationAttempts(int verificationAttempts) {
		this.verificationAttempts = verificationAttempts;
	}
	public Boolean getVerificationLock() {
		return verificationLock;
	}
	public void setVerificationLock(Boolean verificationLock) {
		this.verificationLock = verificationLock;
	}
	public Account getAccount() {
		return account;
	}
	public void setAccount(Account account) {
		this.account = account;
	}
	public Currency getCurrency() {
		return currency;
	}
	public void setCurrency(Currency currency) {
		this.currency = currency;
	}	
}
